import { createRouter, createWebHashHistory, RouteRecordRaw } from 'vue-router';

export const routes: RouteRecordRaw[] = [
  {
    path: '/',
    name: 'index',
    component: () => import('@/views/index/index.vue'),
    meta: { transition: 'slide-left', cache: false }
  },
  {
    path: '/home',
    name: 'home',
    component: () => import('@/views/home/index.vue'),
    meta: { transition: 'slide-left', cache: false }
  }
];
export const router = createRouter({
  history: createWebHashHistory(),
  routes,
  // parseQuery:(search) {
  //   console.log(search, 'router - parseQuery');
  // },
  scrollBehavior: (to, from, savedPosition) => {
    if (savedPosition) {
      return savedPosition;
    }
    return { top: 0 };
  }
});

router.beforeEach((to, from, next) => {
  next();
});

router.afterEach((to, from) => {
  // console.log('to ::: ', to);
  // console.log('from ::: ', from);
});
